/*根据出生日期算出年龄*/
function jsGetAge(birthDate) {
    var returnAge;
    var birthYear = birthDate.toString().substring(0,4);
    var birthMonth = birthDate.toString().substring(4,6);
    var birthDay = birthDate.toString().substring(6);
    // birthDate = "1995-11-08";
    // var birth = birthDate.toString().split("-");
    // var birthYear = birth[0];
    // var birthMonth = birth[1];
    // var birthDay = birth[2];
    // alert(birthYear+"-----------"+birthMonth+"---------"+birthDay)
    d = new Date();
    var nowYear = d.getFullYear();
    var nowMonth = d.getMonth() + 1;
    var nowDay = d.getDate();
    if (nowYear == birthYear) {
        returnAge = 0; //同年 则为0岁  
    } else {
        var ageDiff = nowYear - birthYear; //年之差  
        if (ageDiff > 0) {
            if (nowMonth == birthMonth) {
                var dayDiff = nowDay - birthDay; //日之差  
                if (dayDiff < 0) {
                    returnAge = ageDiff - 1;
                } else {
                    returnAge = ageDiff;
                }
            } else {
                var monthDiff = nowMonth - birthMonth; //月之差  
                if (monthDiff < 0) {
                    returnAge = ageDiff - 1;
                } else {
                    returnAge = ageDiff;
                }
            }
        } else {
            returnAge = -1; //返回-1 表示出生日期输入错误 晚于今天  
        }
    }
    return returnAge; //返回周岁年龄  
}